Readme File:
Replication Archive of "Are Policy Analogies Persuasive? The Household Budget Analogy and Public Support for Austerity" 

Lucy Barnes & Timothy Hicks

British Journal of Political Science
(Contact Lucy Barnes <l.barnes@ucl.ac.uk> for questions relating to the code in this archive.)

====
This replication comes packaged as a zip file to allow us to maintain a folder hierarchy that is useful for distinguishing between the various types of files that are being distributed. The folders and their purposes are as follows.


"./source_data"
----

This folder contains the raw source data that we collected for use in these analyses. The principle is that it should never be directly edited (by hand or by code).



"./codebooks"
----

This folder contains the codebooks describing the source data.



"./scripts"
----

This folder contains three script files containing commands for data processing and analysis:

 - debtAnalogyBJPS_helperfunctions.R : defines some functions for tabulation and graphics which we use in the analyses ;
 - debtAnalogyBJPS_loadclean.R : loads the required datasets, cleans data and generates intermediate variables for analysis;
 - debtAnalogyBJPS_runall.R : performs the analyses used in the paper and in the supplementary material.

The debtAnalogyBJPS_runall.R script is currently configured to generate pdf versions of the figures in the data (written out to the folder "./generated_images", see below), but tables are printed to the console. This can be changed by removing the # symbol on the line "out = " within the stargazer commands, and commenting out (with #) the line "type = text". This will return .tex versions of the tables to "./generated_tex" (see below). Output of other numeric values, output to "./generated_tex" for the generation of the paper, are commented out 



 "./generated_data"
 ----

Contains two output files in .txt format: 

 - debtAnalogyBJPS_output.txt : includes all tables directly referred to in the article, including those in the Supporting Information;
 - debtAnalogyBJPS_outputSupplementary : creates tables (mainly summary statistics) appearing in the Supporting Information but not directly mentioned in the article text. 

These files can be (re-)created by uncommenting the sink() commands in debtAnalogyBJPS_runall.R



"./generated_tex" and "./generated_images"
----

These folders are empty in the replication archive, but are included as various files in the "scripts" folder expect them to be there for the purposes of writing out images and latex fragments for various results that are included in the main text and the supplementary material of the paper. Files in these folders will be over-written when the various scripts are run.


====

How To Use This Replication Archive
----

Open the "./scripts/debtAnalogyBJPS_runall.R" file and edit the initial setwd() command to set the working directory to the scripts folder within this replication archive wherever you have downloaded it. 

Running the debtAnalogyBJPS_runall.R file executes the analyses, as described and labeled (and linked to corresponding tables and figures in the article) in the commented lines within that script file. 


